<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTeacherTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('teacher', function (Blueprint $table) {
            $table->increments('id')->comment('与users中ID 一一对应');
            $table->string('id_card',64)->comment("身份证");
            $table->string('old_name',64)->comment("身份证");
            $table->string('nation',64)->comment("民族");
            $table->string('photo',512)->comment("照片");
            $table->date('birth_date')->comment("出生日期");
            $table->date('start_work_date')->comment("开始工作时间");
            $table->string('hometown',64)->comment("籍贯");
            $table->date('graduate_date')->nullable()->comment("毕业时间");
            $table->string('graduate_school',128)->nullable()->comment("学校");
            $table->string('graduate_major',64)->nullable()->comment("专业");
            $table->string('graduate_school_system',16)->default("FOUR_YEAR")->comment("学制 参考系统代码 SCHOOL_SYSTEM");
            $table->string('graduate_degree',32)->default("")->comment("学位");
            $table->date('acquire_office_date')->nullable()->comment("任职资格获取时间");
            $table->string('politics_status',16)->default('群众')->comment("政治面貌 参考系统代码 POLITICS_STATUS");
            $table->date('join_politics_org_date')->nullable()->comment("入党/团时间");
            $table->string('family_connect_user_name',64)->default('')->comment("家庭联系人");
            $table->string('family_connect_user_relation',64)->default('')->comment("家庭联系人关系");
            $table->string('family_connect_user_mobile',64)->default('')->comment("家庭联系人电话号码");
            $table->string('family_connect_address',512)->default('')->comment("家庭联系人地址");
            $table->string('family_connect_user_company',512)->default('')->comment("家庭联系人公司");
            $table->string('family_connect_user_job',512)->default('')->comment("家庭联系人职位");
            $table->string('created_user',64)->default('')->comment('创建人');
            $table->string('updated_user',64)->default('')->comment('修改人');
            $table->unique('id_card','uniq_id_card');
            $table->timestamps();
        });
        Schema::create('study', function (Blueprint $table) {
            $table->increments('id');
            $table->bigInteger('teacher_id')->comment('教师ID');
            $table->string('sponsor',512)->default('')->comment('主办方');
            $table->string('content',1024)->default('')->comment('进修内容');
            $table->string('score',64)->default('')->comment('成绩');
            $table->date('start_date')->comment('进修开始时间');
            $table->date('finish_date')->comment('进修完成时间');
            $table->string('remark',512)->default('')->comment('备注');
            $table->string('created_user',64)->comment('创建人');
            $table->string('updated_user',64)->comment('修改人');
            $table->timestamps();
        });
        //证书
        Schema::create('certificate', function (Blueprint $table) {
            $table->increments('id');
            $table->bigInteger('teacher_id')->comment('教师ID');
            $table->date('acquire_date')->comment('获得时间');
            $table->string('sponsor',512)->default('')->comment('主办方');
            $table->string('title',64)->default('')->comment('活动名称');
            $table->string('awards_name',64)->default('')->comment('奖项名称');
            $table->string('score',64)->default('')->comment('名次/得分');
            $table->string('electron_attachment',512)->default('')->comment('证书电子件');
            $table->string('created_user',64)->comment('创建人');
            $table->string('updated_user',64)->comment('修改人');
            $table->timestamps();
        });
        //著作
        Schema::create('composition', function (Blueprint $table) {
//            日期、名称、内容摘要、出版/转载/获奖/交流情况、合著/译、备注
            $table->increments('id');
            $table->bigInteger('teacher_id')->comment('教师ID');
            $table->date('acquire_date')->comment('获得时间');
            $table->string('title',64)->default('')->comment('名称');
            $table->string('summary',512)->default('')->comment('摘要');
            $table->text('use_honor_description')->default('')->comment('内容摘要、出版/转载/获奖/交流情况');
            $table->string('write_description',1024)->default('')->comment('合著/译');
            $table->string('created_user',64)->comment('创建人');
            $table->string('updated_user',64)->comment('修改人');
            $table->string('remark',64)->default('')->comment('备注');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('teacher');
        Schema::drop('study');
        Schema::drop('certificate');
        Schema::drop('composition');
    }
}
